package com.sc.study.student.service.impl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

import com.sc.common.utils.DateUtils;
import com.sc.study.student.domain.ScStudentInterview;
import com.sc.study.student.mapper.ScStudentInterviewMapper;
import com.sc.study.student.mapper.ScStudentInterviewTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sc.study.student.service.IScStudentInterviewService;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author sc
 * @date 2022-04-27
 */
@Service
public class ScStudentInterviewServiceImpl implements IScStudentInterviewService 
{
    @Autowired
    private ScStudentInterviewMapper scStudentInterviewMapper;
    @Autowired
    private ScStudentInterviewTypeMapper scStudentInterviewTypeMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public ScStudentInterview selectScStudentInterviewById(Long id)
    {
        return scStudentInterviewMapper.selectScStudentInterviewById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param scStudentInterview 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<ScStudentInterview> selectScStudentInterviewList(ScStudentInterview scStudentInterview)
    {
        return scStudentInterviewMapper.selectScStudentInterviewList(scStudentInterview);
    }

    @Override
    public List<ScStudentInterview> selectScStudentInterviewListByStudentId(ScStudentInterview scStudentInterview)
    {
        return scStudentInterviewMapper.selectScStudentInterviewListByStudentId(scStudentInterview);
    }





    /**
     * 新增【请填写功能名称】
     * 
     * @param scStudentInterview 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertScStudentInterview(ScStudentInterview scStudentInterview) throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
        format.setTimeZone(TimeZone.getTimeZone("UTC"));
        Date callbackTimeStart =format.parse(scStudentInterview.getInterviewtime());
        scStudentInterview.setInterviewtime(DateUtils.dateTimet(callbackTimeStart));

        return scStudentInterviewMapper.insertScStudentInterview(scStudentInterview);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param scStudentInterview 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateScStudentInterview(ScStudentInterview scStudentInterview) throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
        format.setTimeZone(TimeZone.getTimeZone("UTC"));

        Date callbackTimeStart =format.parse(scStudentInterview.getInterviewtime());
        scStudentInterview.setInterviewtime(DateUtils.dateTimet(callbackTimeStart));
        return scStudentInterviewMapper.updateScStudentInterview(scStudentInterview);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteScStudentInterviewByIds(Long[] ids)
    {
        return scStudentInterviewMapper.deleteScStudentInterviewByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteScStudentInterviewById(Long id)
    {
        return scStudentInterviewMapper.deleteScStudentInterviewById(id);
    }
}
